package com.front.web.wx.utils;

import com.alibaba.fastjson.JSONObject;
import com.bootdo.common.utils.Hog;
import com.bootdo.common.utils.HttpUtil;

public class XiaoChengXuUtils {
	
	public static JSONObject getOpenId(String appdId, String secret, String code) {
		
		 String WX_URL = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code";
		 String requestUrl = WX_URL.replace("APPID", appdId). 
	        replace("SECRET",secret).replace("JSCODE", code).//填写自己的appsecret，
	        replace("authorization_code", "authorization_code");
		 try {
			String r =  HttpUtil.doGet(requestUrl);
			Hog.e(r);
			JSONObject j = JSONObject.parseObject(r);
			
			return j;
			
		 } catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		 return null;
	}
}	
